let username = $('#txtUserName').val()
        let password = $('#txtPassword').val()

         //用户名
         let reg = /^[-_a-zA-Z0-9]{4,16}$/
        let flag1 = false
        $('#txtUserName').on('input',function(){
            if(reg.test($('#txtUsername').val())){
            $('span').eq(0).html('可以注册')
            $('span').eq(0).css({color:'#00FFFF'})
            flag1 = true
        }else{
            $('span').eq(0).html('* 请用邮箱或手机号')
            $('span').eq(0).css({color:'red'})
        }
        })

        //密码
        let reg1 = /(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[$@!%*#?&])[A-Za-z\d$@!%*#?&]{6,}$/
        let flag2 = false
        $('#txtPassword').on('input',function(){
            if(reg1.test($('#txtPassword').val())){
            $('span').eq(1).html('密码中')
            $('span').eq(1).css({color:'#00FFFF'})
            flag1 = true
        }else{
            $('span').eq(1).html('* 6-20位字符，建议由字母，数字和符号两种以上组合')
            $('span').eq(1).css({color:'red'})
        }
        })
        let flag3 = false
        $('#txtPassword2').on('input',function () {
           
            console.log($('#txtPassword').val());
            console.log($('#txtPassword2').val());
            if($('#txtPassword2').val()==$('#txtPassword').val()){
                $('span').eq(2).html('√')
                $('span').eq(2).css({color:'green'})
                flag3=true
            }else {
                $('span').eq(2).html('* 请再次输入密码')
                $('span').eq(2).css({color:'red'})
            }
        })

       $('.reg_btn').click(function(){
           console.log(1);
           
           $.ajax({
               url:'http://jx.xuzhixiang.top/ap/api/reg.php',
               type:'get',
               data:{username:$('#txtUsername').val(),password:$('#txtPassword').val()}
           }).then(res=>{
               console.log(res);
               alert(res.msg)
               if(res.code==1){
                   location.href='resign.html'
               }
               
           })
       })